<template>
  <div class="app-container">

    <div id="divSearch" ref="divSearch">
      <el-form :inline="true" :model="Search" class="demo-form-inline">

       

           <el-form-item label="名称" prop="Search">
         
          <el-input v-model.trim="Search.RoleName" placeholder="名称" />

        </el-form-item>
        




        <el-form-item>

          <el-button type="primary" icon="el-icon-search" size="small" @click="getDataList">查询</el-button>
          <el-button type="primary" icon="el-icon-search" size="small" @click="FunRoleAdd">添加</el-button>

        </el-form-item>
      </el-form>
    </div>
    <el-table :data="Datelist" style="width: 100%;margin-top:30px;" border @selection-change="handleSelectionChange">

      <el-table-column type="selection" label="选择" align="center" width="55">

      </el-table-column>

      <el-table-column align="center" label="编号" width="220" >
        <template slot-scope="scope">
          {{ scope.row.RoleCode }}
        </template>
      </el-table-column>
      <el-table-column align="center" label="名称" width="320" sortable prop="path">
        <template slot-scope="scope">
          {{ scope.row.RoleName }}
        </template>
      </el-table-column>

       <el-table-column align="center" label="级别" width="320" sortable prop="path">
        <template slot-scope="scope">
          {{ scope.row.Rolelevel }}
        </template>
      </el-table-column>
     
    </el-table>
    <el-pagination background
                   layout="sizes, prev, pager, next,total"
                   :page-size="Search.pageSize"
                   :total="Search.total"
                   @current-change="pageChange" />






  </div>
</template>

<script>
  import path from 'path'
  import { deepClone } from '@/utils'
  import { getDataList } from '@/api/datalist'


  export default {

    data() {
      return {
        ProjectForm: "",
        inputName: "",
        routes: [],
        Datelist: [],
        multipleTable: [],
        Search: {// 查询条件
          total: 0, // 总记录数
          pageSize: 10, // 一页显示的记录数
          page: 1, // /当前页码
          RNO: '006', // 表编号
          jsWhere: 'and Rolelevel >= 7.0'// 自定义条件
        },

        screenWidth: document.body.clientWidth
      }
    },
    computed: {
      routesData() {
        return this.routes
      }
    },
    created() {

      this.getDataList()
    },

    methods: {
      pageChange(page) { // 翻页
        this.Search.page = page

        this.getDataList()
      },
      async getDataList() { // 获取列表数据，通用
        const res = await getDataList({ data: JSON.stringify(this.Search) })

        this.Datelist = res.data.Table
        this.Search.total = res.data.Table1[0].RecordCount

      },
      sortChange: function (column) {

        this.Search.sort = column.prop + ' ' + column.order

        this.getDataList()
      },
      handleSelectionChange(val) {

        this.multipleTable = val;



      }

      , FunRoleAdd() {

        this.$emit('FunRoleAdd', this.multipleTable);

      }

    }



  }



</script>

<style lang="scss" scoped>
  .app-container {
    .EditObjs-table

  {
    margin-top: 30px;
  }

  .permission-tree {
    margin-bottom: 5px;
  }
  }
</style>
